package cn.edu.zzuli.admin.mapper;

import cn.edu.zzuli.model.dto.admin.OrderDto;
import cn.edu.zzuli.model.entity.OfferOrder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrderMapper extends BaseMapper<OfferOrder> {

    //@Select("select oid,type,ouid,ruid,postTime,finishTime from `offer_order` join `run_order` on roid = oid ${ew.customSqlSegment}")
    @Select("SELECT nick_name as oNickName,ouid,oid,TYPE,title,post_time,bounty,title,ruid,finish_time,refund FROM offer_order JOIN USER ON uid = ouid JOIN run_order ON oid = roid" +
            " ${ew.customSqlSegment}")
    Page<OrderDto> selectListByTypeId(Page<OrderDto> page, @Param(Constants.WRAPPER)QueryWrapper<OrderDto> type);
}
